<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scaleble=no,maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script src="../assets/artTemplate/template-native.js"></script>
<script src="../assets/zepto/zepto.min.js"></script>
<title>模版引擎练习</title>
</head>
<body>
    <div id="myDiv"></div>

    <script id="myDivs" type="text/template">
        <% for(var i=0 ; i< aaa.length ; i++){ %>
            <li>
                <h3>索引号是:<%= i %></h3>
                <span>姓名:<%= aaa[i].name %></span>
                <span>年纪:<%= aaa[i].age %></span>
                <span>恋爱状态:<%= aaa[i].marry %></span>
            </li>
        <% } %>
    </script>
    <script>
        $.ajax({
            url:"data.json",
            type:'get',
            dataType:'json',
            success:function(result){
                console.log(result);
                var html = template("myDivs",{aaa:result.res})
                $("#myDiv").html(html);
            }
        })
        
    </script>
</body>
</html>